<?php
/*
 * 视频显示页面
 * @package    video
 * @author     Mark
 * @copyright  Copyright (c) 2013 ixdcw team
 * @version    $Id: 904e1a7073327bd9e0740f64f1dac35f99bd6fa7 $
 */
defined('IN_IXDCW') or exit('Access Denied');
require DT_CORE . '/' . MODULE_NAME . '/common.inc.php';
$itemId = isset($itemid) ? intval($itemid) : 0;
if ($itemId) {
	$itemInfo = AutoVideo::byItemid($itemId);
	preg_match('/<embed.*?src=[\'"]?([^"\']+)[\'"]?.*?\/>.*/i',$itemInfo['content'],$tem);
	$itemInfo['vUrl'] = $tem[1];
	$catid = $itemInfo['catid'];
	//相关视频
	$do = new VideoModule($moduleid);
	$condition  = 'status = 3 ';
	$condition .= ' and catid = '.$catid;
	$condition .= ' and itemid != '.$itemId;
	$order      = '(case when tag like "%'.$itemInfo['tag'].'%" then 1 else 2 end),rand(),addtime DESC';
	$list = $do->getList($condition,$order);
	if ($itemInfo) {
		AutoVideo::updateHits($itemId);
	} else {
		Prompt::error404();
	}
} else {
	Prompt::error404();
}
include template('show', $module);